function retrieveURL(url, textId){
	//alert('URL: ' + url + '; textId: ' + textId);
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
		//alert('Firefox Browser(s)...........');
	} catch (e){
		//alert('First catch..... IE Browser(s)......... ');
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			//alert('Request Based on Msxml2.XMLHTTP');
		} catch (e) {
			alert('Second catch.....');
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				//alert('Request Based on Microsoft.XMLHTTP');
			} catch (e){
				// Something went wrong
				//alert("Your browser broke!");
				return false;
			}
		}
	}
	//alert('Calling server...........');
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		//alert('Check: 1 -> Readr State: ' + ajaxRequest.readyState);
		if(ajaxRequest.readyState == 4){
			//alert('Check: 2 -> Status: ' + ajaxRequest.status);
			if(ajaxRequest.status == 200) {
				//alert('Check: 3'); 
				//alert(req.responseText);
		          var responsetext = ajaxRequest.responseText;
		          //alert(responsetext);
		          document.getElementById("soundPH").innerHTML = '';
		          if(responsetext.indexOf("The answer is correct") != -1) {
		          	playSound('sound/tada.wav');
		          }
		          else if(responsetext.indexOf("Your answer is wrong") != -1) {
		          	playSound('sound/error.wav');
		          }
		          //document.getElementById(datadisplay).innerHTML = req.responseText;
		          document.getElementById(textId).innerHTML = responsetext;	
			}
			else {
				alert("Problem: " + req.statusText);
			}
		}
	};
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null); 
}


/*
var req;
  var datadisplay;    
  function retrieveURL(url, textId) {
    
	if (window.XMLHttpRequest) { // For IE7+, Firefox, Chrome, Opera 8.0+, Safari
	      req = new XMLHttpRequest();
	      req.onreadystatechange = processStateChange;
	      try {
	        req.open("GET", url, true);
	      } catch (e) {
	    	  alert('Browser: IE7+ or Firefox or Chrome or Opera 8.0+ or Safari' );
	          alert(e);
	      }
	      req.send(null);
	 }
	else {
		// Internet Explorer Browsers
		try{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			alert('First catch! Msxml2.XMLHTTP' );
			try{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Second catch! Your browser outdated!");
				return false;
			}
		}
		if (req) {
	        req.onreadystatechange = processStateChange;
	        req.open("GET", url, true);
	        req.send();
		}
	}
    datadisplay = textId;
  }
  
  function processStateChange() {
    if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response
       // alert(req.responseText);
          var responsetext = req.responseText;
          //alert(responsetext);
          document.getElementById("soundPH").innerHTML = '';
          if(responsetext.indexOf("The answer is correct") != -1) {
          	playSound('sound/tada.wav');
          }
          else if(responsetext.indexOf("Your answer is wrong") != -1) {
          	playSound('sound/error.wav');
          }
          //document.getElementById(datadisplay).innerHTML = req.responseText;
          document.getElementById(datadisplay).innerHTML = responsetext;
      } else {
        alert("Problem: " + req.statusText);
      }
    }
  }  */
  
	function playSound(soundfile) {
		document.getElementById("soundPH").innerHTML=document.getElementById("soundPH").innerHTML +
			"<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
	}